<template>
  <div class="notice">
    <div class="top">
      <img
        src="../../assets/images/cz1.png"
        alt=""
        class="top-img1"
        @click="goback"
      />
      <p class="top-p">{{ $t("common.tongzhis") }}</p>
    </div>
    <div v-show="!notice.length" class="noMessage">
      <img src="../../assets/images/null.png" alt="" />
      <p>{{ $t("common.zanwu") }}</p>
    </div>
    <div
      class="content"
      v-for="item in notice"
      :key="item.id"
      @click="toDetail(item)"
    >
      <div class="title">
        <img src="../../assets/images/notice1.png" alt="" />
        <p class="p1"></p>
        <p class="p2">{{ item.title }}</p>
      </div>
      <div class="center">{{ item.message }}</div>
      <div class="time">{{ item.createTime }}</div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      notice: [],
    };
  },

  async activated() {
    this.getList();
  },
  methods: {
    async getList() {
      const ret = await this.$http({
        url: "/wallet/notification/app/page",
        method: "post",
        data: {
          current: 1,
          size: 100,
        },
      });
      if (ret.data.code === 0) {
        this.notice = ret.data.data.records;
      }
    },
    toDetail(item) {
      console.log(item);
      if (item.noticeType == 1) {
        this.$router.push({
          path: "/details_cz",
          query: {
            zid: item.recordId,
          },
        });
      } else if (item.noticeType == 2) {
        this.$router.push({
          path: "/details_tx",
          query: {
            zid: item.recordId,
          },
        });
      }
    },

    goback() {
      this.$router.go("-1");
    },
  },
};
</script>

<style scoped lang="scss">
.notice {
  margin: 0;
  padding: 0;
  min-height: 216.53vw;
  .top {
    height: 11.73vw;
    width: 100vw;
    display: flex;
    align-items: center;
    //font-family: Microsoft Yahei;
    .top-img1 {
      height: 5.3vw;
      width: 5.3vw;
      left: 2.4vw;
      position: absolute;
    }
    .top-p {
      font-size: 4.8vw;
      margin: 0 auto;
      color: rgba(255, 255, 255, 100);
    }
  }
  .noMessage {
    img {
      width: 17.33vw;
      height: 17.33vw;
      margin-top: 13.6vw;
    }
    p {
      color: rgba(79, 82, 93, 100);
      font-size: 3.2vw;
      margin-top: 1.06vw;
    }
  }
  .content {
    height: 33.06vw;
    .title {
      height: 10.66vw;
      display: flex;
      img {
        width: 4.26vw;
        height: 4.26vw;
        position: relative;
        top: 5.86vw;
        left: 3.46vw;
      }
      .p1 {
        width: 1.06vw;
        height: 1.06vw;
        background-color: rgba(10, 122, 255, 100);
        position: relative;
        top: 7.46vw;
        left: 6.66vw;
        border-radius: 13.33vw;
      }
      .p2 {
        // width: 14.93vw;
        height: 5.33vw;
        color: rgba(234, 236, 248, 100);
        font-size: 3.73vw;
        text-align: left;
        font-family: PingFangSC-regular;
        position: relative;
        top: 6vw;
        left: 8vw;
      }
    }
    .center {
      width: 76.26vw;
      line-height: 20px;
      // height: 12vw;
      color: rgba(153, 153, 153, 100);
      font-size: 3.73vw;
      text-align: left;
      font-family: PingFangSC-regular;
      position: relative;
      left: 10.66vw;
      top: 2.13vw;
    }
    .time {
      height: 3.73vw;
      color: rgba(153, 153, 153, 100);
      font-size: 2.66vw;
      text-align: left;
      font-family: PingFangSC-regular;
      position: relative;
      top: 3.2vw;
      left: 10.66vw;
    }
  }
}
</style>